#include<stdio.h>

int main(void)
{
    char ch1[31];
    int n;

    scanf("%s",ch1);
    scanf("%d",&n);

    for (int i = n - 1; ch1[i] != '\0'; i++)
    {
        printf("%c",ch1[i]);
    }
    
}